﻿@model List<PerformanceAssessment.Models.EmployeeList>
<h2>Objectives</h2>
<p>
     
    <p>
        <div style="display: inline-block">
        @using (Html.BeginForm("Index", "Objectives", FormMethod.Get))
        {
            <Label>Team:</label>@Html.DropDownList("teamString", "All");
            <input type="submit" value="Filter" />
        }
            </div>
        <div style="display: inline-block">
            <input type="submit" id="saveObjectives" value="Save" onclick="Save()"/>
    </div>

    </p>
</p>
<table>
    <tr>
        <th>
            Team
        </th>
        <th>
            Name
        </th>
        <th>
        </th>
    </tr>
    @using(Html.BeginForm("SaveIndex","Objectives",FormMethod.Post, new{id="objectivesPermisions"}))
    {
        for (var i = 0; i < Model.Count(); i ++)
        {
            <tr>
                <td>
                    @Html.DisplayFor(m => m[i].Team)                
                    @Html.HiddenFor(m => m[i].ID)                
                </td>
                <td>
                    @Html.DisplayFor(m => m[i].Name)                
                </td>
                <td>
                    @if (Model[i].CanEditGoal)
                    {
                        @Html.CheckBoxFor(m => m[i].CanEditGoal, new {@checked = "checked"})
                    }
                    else if (!Model[i].CanEditGoal)
                    {
                        @Html.CheckBoxFor(model => model[i].CanEditGoal)
                    }
                </td>
            </tr>

        }
    }
</table>
<script>
function Save() {
    $("#objectivesPermisions").submit();
}
</script>
